/*class Animal {
    String name;
    int age;
    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }
    public void eat() {
        System.out.println("吃饭");
    }
}
class Dog extends Animal {
    String name = "hh";
    int age = 22;
    public Dog() {
        super("你好",18);
    }
    public void print() {
        System.out.println(super.name);
        System.out.println(super.age);
    }
}*//*

class Student {
    public Student(int num, int age) {

    }
}
class A extends Student {

    public A(int num, int age) {
        super(num, age);
    }
}
public class JavaSE730 {
    public static void main(String[] args) {
      */
/*  Dog dog = new Dog();
        dog.eat();
        dog.print();*//*

    }
}
*/


/*

class Animal {
    int age;
    static String name;
    static {
        System.out.println("父类的静态代码块");
    }
    {
        System.out.println("父类的实例代码块");
    }
    public Animal() {
        System.out.println("父类构造方法");
    }
}
class Dog extends Animal{
    static {
        System.out.println("子类的静态代码块");
    }
    {
        System.out.println("子类的实例代码块");
    }
    public Dog() {
        System.out.println("子类构造方法");
    }

}
public class JavaSE730 {
    public static void main(String[] args) {
        Dog dog = new Dog();
        System.out.println("=============");
        Dog dog1 = new Dog();
    }
}*/

/*

//轮胎类
class Tire {
    int num;
}
//汽车类
class Car {
    Tire tire;//可以将类用在另外的类中，当一个字段。这样也可以复用Tire类的代码

    public void make() {
        tire.num = 10;
    }
}*/

//重写（返回值类型变了）
/*class A {
    public A eat() {
        return new A();
    }
}
class B extends A {
    @Override
    public B eat() {
        return new B();
    }
}*/
/*
class Animal {
    String name;
    int age;

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }
    public void eat() {
        System.out.println(name + "吃饭");
    }
}
class Cat extends Animal {
    public Cat(String name, int age) {
        super(name,age);
    }
    @Override
    public void eat() {
        System.out.println(name + "吃鱼");
    }
}
class Dog extends Animal {
    public Dog(String name, int age) {
        super(name,age);
    }
    @Override
    public void eat() {
        System.out.println(name + "吃骨头");
    }
}
public class JavaSE730 {
    //2.通过参数来向上转型，用父类来接受，可以介绍任何的子类
    public static void eatFood(Animal a){
        a.eat();
    }
    //3.当成返回值来向上转型
    public static Animal buyAnimal(String var){
        if("狗" == var){
            return new Dog("狗狗",1);
        }else if("猫" == var){
            return new Cat("猫猫", 1);
        }else{
            return null;
        }
    }
    public static void main(String[] args) {
        Animal cat = new Cat("元宝",2); // 1. 直接赋值：子类对象赋值给父类对象
        Dog dog = new Dog("小七",3);
        eatFood(cat);
        eatFood(dog);//2.将子类dog对象传过去，那边用Animal接收，也发上向上转型
    }
}*/
abstract class A {
    abstract void func();
}

public class JavaSE730 {
}